#include "implementation.h"

using std::string;
using std::vector;

using boost::phoenix::function;

string implementation::vector_to_string(vector<char> v)
{
	string s;
	for (size_t i = 0; i < v.size(); i++)
		s.push_back(v[i]);
	return s;
}

big_int implementation::power(big_int a, big_int b)
{
	if (b == big_int(0))
		return big_int(1);
	if (b % big_int(2) == big_int(0))
	{
		big_int tmp = power(a, b / big_int(2));
		return tmp*tmp;
	} else
		return a * power(a, b - big_int(1));
}

function<implementation::big_int_implementation>& implementation::big_int_constructor()
{
	static function<implementation::big_int_implementation> f;
	return f;
}

function<implementation::power_implementation>& implementation::power()
{
	static function<implementation::power_implementation> f;
	return f;
}

function<implementation::function_implementation>& implementation::function_()
{
	static function<implementation::function_implementation> f;
	return f;
}
